import pandas as pd
import numpy as np
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)

df = pd.read_csv(r'911.csv')
# print(df)
# print(df.info())
# print(df.iloc[0])

temp_list = df['title'].str.split(':').tolist()
cate_list = list(set(i[0] for i in temp_list))
# print(cate_list)
zeros_df = pd.DataFrame(np.zeros((df.shape[0], len(cate_list))), columns=cate_list)
# print(zeros_df)
for cate in cate_list:
    zeros_df[cate][df["title"].str.contains(cate)] = 1
sum_res = zeros_df.sum(axis=0)
print(sum_res)